I have an existing Angular Application that started development at the time of Angular 4, now it's on Angular 12. But at the time of development, the strict mode was not enabled. Now after the application is stable and also deployed on production, what's the best way to enable strict mode stey by step i.e. in phases instead of turning every strict option on.
I have already read the answer here Angular 10 Stricter Settings --strict , which is for generally enabling strict mode.
My question is related to how to enable it in phases. As the application size/complexity is medium level, therefore it will be a major challenge to test all of the changes at once.
There are a few options I see in angular strict config such as, some of them can be configured manually as well some are turn on by strict:true:
tslint.json "no-any": trueWhat's the best way to enable these settings, step by step, in a specific order which is better? So that it can be tested and deployed to production in phases instead of one whole chunk which has changes of bug/issue going unnoticed. Any help would be appreciated especially by someone who has gone through updating an already existing project, in a bits by bits manner instead of one whole push.
One good approach:
any type.HttpClient's functions: get, put, post, delete. Say, you're expecting a number type from an api call, then you'd add they type to the function invocation: this.http.get<number>(someAPIUrl). Most of the libraries have good documentation on their typings.tsconfig flags such as noImplicitAny - this will help narrow down the places where you need to add more typing that you may have overlooked. At this point, you can even turn on strict mode as well.Of course, it may take some time before you get to where you want and expect some things to break before you fix them. So working through it bit by bit my help.
Just to note, there's more work that the Angular Team is doing to improve typing such as Typed Forms.